<template>
	<view class="consult">
		<!-- 资迅中心 -->
		<view v-if="consultArr.length > 0">
			<view class="consult-main">
				<view v-for="(item,index) in consultArr" :key="index" @tap="indetails(item.id)">
					<view class="consult-main-img">
						<image :src="item.pic_url" mode=""></image>
						<view class="title-text">{{item.title}}</view>
					</view>
					<view class="consult-main-text">
						<image class="consult-icon" src="../../static/images/tabbar/eyes.png" mode=""></image>
						<view class="consult-pageView">{{item.count}}</view>
						<view class="consult-time">{{item.createtime}}</view>
					</view>
				</view>
			</view>
			<view class="noMore">没有更多了~</view>
		</view>
		<view v-else>
			<none></none>
		</view>
		<!-- tabbar -->
		<tabBar currentPage="consult"></tabBar>
	</view>
</template>

<script>
	import tabBar from "@/component/commen/tabbar.vue"//引入底部组件
	import $http from "@/component/commen/api/request.js";//引入封装的请求
	import none from "@/otherPages/none/none.vue"
	export default {
		components:{
			tabBar,none
		},
		data() {
			return {
				consultArr:[],
			};
		},
		mounted() {
			this.getConsultData()
		},
		methods:{
			getConsultData(){//获取资迅数据
				$http({
					url:"?i=2&t=0&v=2.7.4&from=wxapp&c=entry&a=wxapp&do=info&m=wjyk_recycle&sign=08abffc8ecae790556121b1743a49186",
					method:"get"
				}).then((res)=>{
					this.consultArr = res.data.list
					// console.log(this.consultArr)
				})
			},
			indetails(index){//点击跳转至资迅详情页
				// console.log(index)
				var a = this.consultArr.findIndex(item=>item.id===index)
				if(a != -1){
					let datailData = this.consultArr[a]
					uni.navigateTo({
						url:`/otherPages/information-details/information-details?datailData=${encodeURIComponent(JSON.stringify(datailData))}`
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
.consult{
	// border:1px solid #f00;
	padding-bottom: 150rpx;//其中120rpx为底部tabbar的高度
	.consult-main{
		background: #fff;
		.consult-main-img{
			padding: 20rpx 40rpx;
			image{
				width: 100%;
				height: 300rpx;
			}
			.title-text{
				margin-top: 10rpx;
				font-size: 27rpx;
			}
		}
		.consult-main-text{
			font-size: 25rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			padding:10rpx 40rpx;
			border-top: #f7f7f7 4rpx solid;
			border-bottom: #f7f7f7 4rpx solid;
			color: #8a8a8a;
			.consult-icon{
				// border: 1px solid #000;
				width: 29rpx;
				height: 29rpx;
				margin-right: 10rpx;
			}
			.consult-pageView{
				width:10%;
				// border: 1px solid #000;
			}
			.consult-time{
				width: 90%;
				text-align: right;
				// border: 1px solid #f00;
			}
		}
	}
	.noMore{
		width: 100%;
		text-align: center;
		margin-top: 50rpx;
		font-size: 25rpx;
		color: #ccc;
	}
}
</style>
